package cn.nucun.entity.po;


import com.alibaba.fastjson.annotation.JSONField;

import java.util.Date;

import static cn.nucun.entity.constant.SocketConstant.MegType.MT_TYPE_ALL_RESERVE;
import static cn.nucun.entity.constant.SocketConstant.Systems.SYS_USER_KEY;

/**
 * @author 3
 */
public class Message {

    /**
     * 发送者name
     */
    public String from;
    /**
     * 接收者name
     */
    public String to;
    /**
     * 发送的文本
     */
    public String text;
    /**
     * 发送时间
     */
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    public Date date;


    public Message() {
    }

    public Message(String msg) {
        date = new Date();
        from = System.getProperty(SYS_USER_KEY);
        to = MT_TYPE_ALL_RESERVE;
        text = msg;
    }

    public String getFrom() {
        return from;
    }

    public void setFrom(String from) {
        this.from = from;
    }

    public String getTo() {
        return to;
    }

    public void setTo(String to) {
        this.to = to;
    }

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }
}
